import * as React from "react";
import { SafeAreaView, View, TextInput, StyleSheet } from "react-native";
import Button from "react-native-button";

export default class Sponsor extends React.Component {
  state = {
    amount: 0,
    desc: "",
    title: ""
  };

  onSubmit() {
    alert(123);
  }
  render() {
    return (
      <SafeAreaView style={styles.container}>
        <View style={styles.forms}>
          <TextInput
            style={styles.textInput}
            placeholder="金额"
            onChangeText={amount => this.setState({ amount })}
          />
          <TextInput
            style={styles.textInput}
            placeholder="标题(27个字以内)"
            onChangeText={title => this.setState({ title })}
          />
          <TextInput
            style={styles.textArea}
            multiline={true}
            numberOfLines={4}
            placeholder="简单描述一下细节"
            onChangeText={desc => this.setState({ desc })}
          />
          <Button style={styles.submitButton} onPress={this.onSubmit}>
            提交
          </Button>
        </View>
      </SafeAreaView>
    );
  }
}

const styles = StyleSheet.create({
  container: {
    flex: 1,
    backgroundColor: "#fff"
  },
  forms: {
    margin: 30
  },
  textInput: {
    height: 50,
    lineHeight: 50,
    marginBottom: 20,
    borderColor: "#eee",
    borderWidth: 1,
    padding: 10
  },

  textArea: {
    height: 100,
    borderColor: "#eee",
    borderWidth: 1,
    padding: 10
  },

  submitButton: {
    margin: 20,
    color: "#fff",
    height: 50,
    lineHeight: 50,
    backgroundColor: "#9933CC"
  }
});
